function fetchUserData() {
  return $.ajax({
    url: 'https://api.example.com/userinfo'
  });
}

function fetchUserOrders(userId: any) {
  return $.ajax({
    url: 'https://api.example.com/orders',
    data: { userId: userId }
  });
}

function fetchBillingInfo(orderId: any) {
  return $.ajax({
    url: 'https://api.example.com/billing',
    data: { orderId: orderId }
  });
}

fetchUserData()
  .then(user => {
    console.log('用户信息:', user);
    return fetchUserOrders(user.id);
  })
  .then(orders => {
    console.log('用户订单:', orders);
    return fetchBillingInfo(orders[0].id);
  })
  .then(billing => {
    console.log('账单信息:', billing);
  })
  .catch(error => {
    console.error('请求失败:', error);
  });